package com.yykj.prescription.server.converter;

import com.yykj.prescription.client.dto.PrescriptionMemberDTO;
import com.yykj.prescription.server.model.entity.prescription.PrescriptionMember;
import org.springframework.beans.BeanUtils;

import java.util.List;
import java.util.stream.Collectors;

public class PrescriptionMemberDTOConverter {

    public static PrescriptionMemberDTO convert(PrescriptionMember item){
        PrescriptionMemberDTO dto = new PrescriptionMemberDTO();
        BeanUtils.copyProperties(item,dto);
        return dto;
    }

    public static List<PrescriptionMemberDTO> convert(List<PrescriptionMember> itemList){
        return itemList.stream().map(PrescriptionMemberDTOConverter::convert).collect(Collectors.toList());
    }
}
